package com.coffeeloversupportlibrary.coffeelover.mercury.login;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.AppCompatButton;

import com.coffeeloversupportlibrary.R;
import com.coffeeloversupportlibrary.coffeelover.domain.MainActivity;


/**
 * @author 盛守义
 * @createTime 2021/10/24 16:19
 * @projectName TurningCoffee
 * @className WelcomeActivity.java
 * @description TODO
 */
public class WelcomeActivity extends Activity {

    private AppCompatButton login, regist;
    private AppCompatButton btn_casualwelc;

    private Intent intent;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_welcome);

        initView();
        setListener();
    }

    class MyClickListener implements View.OnClickListener{

        @Override
        public void onClick(View view) {
            switch (view.getId()){
                case R.id.btn_loginwelc:
                    intent = new Intent(WelcomeActivity.this, LoginActivity.class);
                    startActivity(intent);
                    finish();
                    break;
                case R.id.btn_registwelc:
                    intent = new Intent(WelcomeActivity.this, RegistActivity.class);
                    startActivity(intent);
                    finish();
                    break;
                case R.id.btn_casualwelc:
                    intent = new Intent(WelcomeActivity.this, MainActivity.class);
                    startActivity(intent);
                    break;
            }
        }
    }

    void initView(){
        login = findViewById(R.id.btn_loginwelc);
        regist = findViewById(R.id.btn_registwelc);
        btn_casualwelc = findViewById(R.id.btn_casualwelc);
    }

    void setListener(){
        MyClickListener listener = new MyClickListener();
        login.setOnClickListener(listener);
        regist.setOnClickListener(listener);
        btn_casualwelc.setOnClickListener(listener);
    }
}
